package org.example.ch01.p04;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextLine()){
            String input=scanner.nextLine().trim();
            if (input.isEmpty()){
                continue;
            }
            try{
                double x=Double.parseDouble(input);
                if (x<0){
                    System.out.println("NaN");
                }else{
                    double step=0.0001;
                    double epsilon=0.0001;
                    double result=0;
                    while(result*result<x&&Math.abs(x-result*result)>epsilon){
                        result+=step;
                    }
                    System.out.printf("%.6f\n",result);
                }
            }catch (NumberFormatException e){

            }
        }
        scanner.close();
    }
}
